/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.assg2.dao;

import com.movie.Book;
import com.movie.Viewer;
import java.util.List;
import org.hibernate.Query;

/**
 *
 * @author alexnewski
 */
public class DaoBook extends GenericDao {

    public DaoBook() {
        super(Book.class);
    }

    public List<Book> BookinList(Viewer v) {
        Query q = query("select b from Book b, Viewer v where b.viewerIdviewer=v.idviewer and v.idviewer=" + Integer.toString(v.getIdviewer()));
        System.out.println(q.toString());
        if (q.list().get(0) != null) {
            return q.list();
        } else {
            return null;
        }
    }
}
